[LDAP] The distinguished name contains invalid syntax ERROR!!

Posted by handle0088 on Stack Overflow See other posts from Stack Overflow or by handle0088
Published on 2010-06-02T17:01:28Z Indexed on 2010/06/02 17:03 UTC
Read the original article Hit count: 334

Filed under:

I'm trying using LDAP to authenticate user, but I have a problem with LDAP. This is my code

string hostOrDomainName = "MrHand-PC";
            string targetOu = "cn=Huy Pham,ou=people,dc=example,dc=com";

            // create a search filter to find all objects
            string ldapSearchFilter = "uid=pdhuy";

            // establish a connection to the directory
            LdapConnection connection = new LdapConnection(hostOrDomainName);

            Console.WriteLine("\r\nPerforming a simple search ...");
            SearchRequest searchRequest = new SearchRequest(targetOu, ldapSearchFilter, 
                System.DirectoryServices.Protocols.SearchScope.OneLevel, null);

            // cast the returned directory response as a SearchResponse object
            SearchResponse searchResponse =
                        (SearchResponse)connection.SendRequest(searchRequest); << **Throw exception: The distinguished name contains invalid syntax.**

Can anyone help my solve this problem. Thank you so much.

© Stack Overflow or respective owner

Related posts about openldap